package ejbserviceclient;

import com.softcomputer.rpt.entities.ExCourse;
import com.softcomputer.rpt.entities.ObjectFactory;
import com.softcomputer.rpt.interfaces.Echo;
import java.math.BigInteger;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;

public class App {

    public static void main(String[] args) throws MalformedURLException {

        URL url = new URL("http://IPSedin:8080/EchoBeanService/EchoBean?wsdl");
        QName serviceName = new QName(
                "http://ejb.rpt.softcomputer.com/",
                "EchoBeanService");
        QName portName = new QName(
                "http://ejb.rpt.softcomputer.com/",
                "EchoBeanPort");

        Service remote = Service.create(url, serviceName);
        Echo ejbService = remote.getPort(portName, Echo.class);

        ObjectFactory factory = new ObjectFactory();
        ExCourse newCourse = factory.createExCourse();

        newCourse.setCurrencyName("RUR");
        newCourse.setId(new BigInteger("1"));
        newCourse.setIndollars(30f);

        System.out.println(ejbService.echo("test service..."));
        System.out.println(ejbService.processNewCourse(newCourse));

    }
}